package com.x.client.net

import com.gg.net.ApiFactory
import com.x.client.App

/**
 * Creator : GG
 * Date    : 2018/3/2
 * Mail    : gg.jin.yu@gmai.com
 * Explain :
 */
object ApiFactory : ApiFactory() {

    private var clientApi: ClientApi? = null

    fun getClientApi(): ClientApi {
        if (clientApi == null)
            clientApi = mRetrofitBuilder.baseUrl(App.instance.getClientUrl()).build().create(ClientApi::class.java)

        return clientApi
                ?: mRetrofitBuilder.baseUrl(App.instance.getClientUrl()).build().create(ClientApi::class.java)
    }

    private var erpApi: ErpApi? = null

    fun getErpApi(): ErpApi {
        if (erpApi == null)
            erpApi = mRetrofitBuilder.baseUrl(App.instance.getErpUrl()).build().create(ErpApi::class.java)

        return erpApi
                ?: mRetrofitBuilder.baseUrl(App.instance.getErpUrl()).build().create(ErpApi::class.java)
    }
}